package com.aqarat.managedBean;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;

import com.aqarat.controller.AqaratController;
import com.aqarat.controller.AqaratControllerImpl;
import com.aqarat.entity.Building;
import com.core.managedBean.BaseBean;

/**
 * @author karimsherif
 * 
 */
@ManagedBean
@ViewScoped
public class BuildingBean extends BaseBean {
	private static final long serialVersionUID = 1L;
	private Building building;
	private AqaratController aqaratController;

	@PostConstruct
	public void loadData() {
		if (aqaratController == null) {
			aqaratController = new AqaratControllerImpl();
		}
		if(building==null){
			building=new Building();
		}
		
		
	}
	public void saveBuilding(){
		try {
//			aqaratController.saveBuilding(building);
			super.addInfoMessage("Successfully Saved");
		} catch (Exception e) {
			e.printStackTrace();
			super.addErrorMessage("An Error Occured when Saving");
		}
	}
	public void setBuilding(Building building) {
		this.building = building;
	}

	public Building getBuilding() {
		return building;
	}

}
